<%@ page import="com.medranocg.gd.DocumentType" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'documentType.label', default: 'DocumentType')}" />
		<title><g:message code="documentType.label" /></title>
	</head>
    <body>
        <div class="container">
        <div class="main-panel">
        <div class="panel panel-default">
        <div class="panel-heading"><h2><g:message code="documentType.label" /></h2></div>
        <div class="panel-body">

        <g:if test="${flash.message}">
            <g:if test="${flash.success == null || flash.success}">
        <div class="alert alert-success" role="status">${flash.message}</div>
            </g:if>
            <g:else>
        <div class="alert alert-danger" role="status">${flash.message}</div>
            </g:else>
        </g:if>



        <g:hasErrors bean="${documentTypeInstance}">
        <div class="alert alert-danger">
        <ul class="errors" role="alert">
            <g:eachError bean="${documentTypeInstance}" var="error">
            <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if><g:message error="${error}"/></li>
            </g:eachError>
        </ul>
        </div>
        </g:hasErrors>


        <form class="form-horizontal" role="form">

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.name.label" default="Nombre" /></label>
            <div class="col-sm-10">
              <p class="form-control-static">${documentTypeInstance.name}</p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.purgeable.label" default="Purgable" /></label>
            <div class="col-sm-10">
              <p class="form-control-static"><g:formatBoolean boolean="${documentTypeInstance?.purgeable}" true="Sí" false="No" /></p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.hasExpiration.label" default="Tiene vencimiento" /></label>
            <div class="col-sm-10">
              <p class="form-control-static"><g:formatBoolean boolean="${documentTypeInstance?.hasExpiration}" true="Sí" false="No" /></p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.defaultLastingMonths.label" default="Duración por defecto en meses" /></label>
            <div class="col-sm-10">
              <p class="form-control-static">${documentTypeInstance.defaultLastingMonths}</p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.daysInAdvanceForNotice.label" default="Días de anticipo para notificación" /></label>
            <div class="col-sm-10">
              <p class="form-control-static">${documentTypeInstance.daysInAdvanceForNotice}</p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.versionable.label" default="Versionable" /></label>
            <div class="col-sm-10">
              <p class="form-control-static"><g:formatBoolean boolean="${documentTypeInstance?.versionable}" true="Sí" false="No" /></p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.uploadNotificationEmailAddress.label" default="Correo electrónico para notificación de carga" /></label>
            <div class="col-sm-10">
              <p class="form-control-static">${documentTypeInstance.uploadNotificationEmailAddress?: '-'}</p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.fileTypes.label" default="Tipos de carga" /></label>
            <div class="col-sm-10">
              <p class="form-control-static">
              <g:each in="${documentTypeInstance.fileTypes}" var="f">
			    ${f?.encodeAsHTML()} <br/>
			  </g:each>
              </p>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label"><g:message code="documentType.shortName.label" default="Nombre archivo" /></label>
            <div class="col-sm-10">
              <p class="form-control-static">${documentTypeInstance.shortName}</p>
            </div>
          </div>

        </form>

        <g:form url="${createLink(action: 'delete', id: documentTypeInstance.id)}" method="DELETE">
				<fieldset class="buttons">
					<a href="${createLink(action: 'edit', id: documentTypeInstance.id)}" class="btn btn-default"><g:message code="default.button.edit.label" default="Editar" /></a>
					<g:actionSubmit class="btn btn-danger" action="delete" value="${message(code: 'default.button.delete.label', default: 'Eliminar')}" onclick="return confirm('${message(code: 'documentType.button.delete.confirm.message', default: 'Are you sure?')}');" />
				</fieldset>
		</g:form>
	
        </div>
        </div>
        </div>
        </div>
      </body>
</html>
